package com.sgmw.sales.tool.kong.sign.request;

import java.util.LinkedHashMap;
import java.util.Map;

import com.sgmw.sales.tool.kong.sign.request.body.RequestBody;

public abstract class AbstractHttpRequest implements HttpRequest{
	private String method;
	private String uri;
	private LinkedHashMap<String,String> queryParamMap;
	private RequestBody requestBody;
	
	public AbstractHttpRequest(String method, String uri, LinkedHashMap<String, String> queryParamMap,RequestBody requestBody) {
		this.method = method;
		this.uri = uri;
		this.queryParamMap = queryParamMap;
		this.requestBody = requestBody;
	}
	
	@Override
	public String getUri() {
		return this.uri;
	}
	@Override
	public String getMethod() {
		return this.method;
	}
	@Override
	public Map<String, String> getQueryParamMap() {
		return this.queryParamMap;
	}

	public boolean isGet() {
		if("GET".equalsIgnoreCase(method)) {
			return true;
		}
		return false;
	}
	
	public boolean isDelete() {
		if("DELETE".equalsIgnoreCase(method)) {
			return true;
		}
		return false;
	}
	
	public boolean isPut() {
		if("PUT".equalsIgnoreCase(method)) {
			return true;
		}
		return false;
	}
	
	public boolean isPost() {
		if("POST".equalsIgnoreCase(method)) {
			return true;
		}
		return false;
	}

	@Override
	public RequestBody getRequestBody() {
		return this.requestBody;
	}
}
